package com.wq.code;

import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

/**
 * @Author: wangqiang20995
 * @Date:19-2-17
 * @Description:
 * @Resource:
 */
public class MergeArray {

    public static void main(String args[]){
        Integer[] ary1 = {1,2,3,4,5,0,0,0};
        Integer[] ary2 = {4,5,7};

        System.arraycopy(ary2,0,ary1,5,ary2.length);

        Comparator<Integer> comparator = Integer::compare;

        List<Integer> list = Arrays.asList(ary1);
        Collections.sort(list,comparator);

        printArray(list);
    }

    private static <T> void printArray(List<T> list){
        for(T t : list){
            System.out.println(t);
        }
    }
}
